UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ScKd5mO30yf+n5r2H8fKIqPYQEDk8wWeElbgY8cNCXg='
WHERE
key_id = 'e61026f43e3e1b07811d0ab1b1dc16b6030272bbbc524ae91a6021efebddd334'
AND (
token = 'ScKd5mO30yf+n5r2H8fKIqPYQEDk8wWeElbgY8cNCXg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)