UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RQhIaEyIj9ejhWx66CnRVoeLYvEHY+kD0+3+ZrLx0LQ='
WHERE
key_id = '8f7c590062a1cd56bf24586a7c3789cdd81f7a9d6cde64c843a0195e839281cf'
AND (
token = 'RQhIaEyIj9ejhWx66CnRVoeLYvEHY+kD0+3+ZrLx0LQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)