UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wOT/48IyWf4+ghVaCCnS8oEThJLJNN40k14yVKaFyJs='
WHERE
key_id = 'c1ff80cfb8aeee8d243a9bc9ebd2b3bdc4efe5463906793ac19a05e3be86409f'
AND (
token = 'wOT/48IyWf4+ghVaCCnS8oEThJLJNN40k14yVKaFyJs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)