UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G9/b8Va9hgUHmLw2tlIaury2VH1C41g7qUrcJbw23wI='
WHERE
key_id = 'b33ca84442b7b5db0d8d0c78999399627cec568cf70abd67624fc01ce30f8ea2'
AND (
token = 'G9/b8Va9hgUHmLw2tlIaury2VH1C41g7qUrcJbw23wI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)