UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a8Fbo7C2igCbue5CLJfPsPHskuMjdgly1jD1kqhb2kY='
WHERE
key_id = 'e366532abed365c9a84618ebdb4da6c8d92bc6be4e4e56fa7ed6c4cdd7ffe85f'
AND (
token = 'a8Fbo7C2igCbue5CLJfPsPHskuMjdgly1jD1kqhb2kY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)