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