UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0jpaefDq+hIyz7IH3QwuEP/M/2RmAAMSTJeV+GHzLpg='
WHERE
key_id = 'b7b7d9bcb2f55aba966de3176e35ad83f7dfe131e398165157d5e9ced83b9332'
AND (
token = '0jpaefDq+hIyz7IH3QwuEP/M/2RmAAMSTJeV+GHzLpg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)