UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rQmjcW7/MQILJfXHqScdrLoYP+70hbBmVz0bX0OOGSU='
WHERE
key_id = 'fe4cb9a289f35bfec2783722d852b18d4e8877e9751918a6ac127d6f5bb5484a'
AND (
token = 'rQmjcW7/MQILJfXHqScdrLoYP+70hbBmVz0bX0OOGSU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)