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