UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qO61gBvYY+1kGwgC4hqCRq4tlF7ed92ebxCHiyfWWdI='
WHERE
key_id = 'c8e83603db64cf932a531261d9c26991e23005e3b86ba213deb12d9cc47b5801'
AND (
token = 'qO61gBvYY+1kGwgC4hqCRq4tlF7ed92ebxCHiyfWWdI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)