UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ka8lUJ0xSRG8wQB0BuQsQ2iyJsOScnNLmEOk6d91OYY='
WHERE
key_id = '7ebb109d7b0685b9de601abe34de579747b2959cd8cbfdcb0e62cde313a7d81e'
AND (
token = 'ka8lUJ0xSRG8wQB0BuQsQ2iyJsOScnNLmEOk6d91OYY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)