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