UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6M0SOqOdSqI2pMbaIIYLkJT8Tta7J29wQW+PHEn2XgA='
WHERE
key_id = 'bce074ccae9e816933b883296e1a7ca26571425817e941baa4a5e2ba0f493a2d'
AND (
token = '6M0SOqOdSqI2pMbaIIYLkJT8Tta7J29wQW+PHEn2XgA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)