UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6W4+XMip3B552K0cp4PSSiwYOJt9r395mCuXamf6xCs='
WHERE
key_id = '36f8bcb00174b4d1a7f2520afbfcaabfe88891537b42ecd657e748f77abffdaf'
AND (
token = '6W4+XMip3B552K0cp4PSSiwYOJt9r395mCuXamf6xCs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)