UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'v4M6nIcNMuPZEPO1QedlceQ+Efs8nIiZhn95oxP594Q='
WHERE
key_id = 'e590ae08955d578b822630ac28e29e9b84e5ab37ce3344315911aab66ca4a05d'
AND (
token = 'v4M6nIcNMuPZEPO1QedlceQ+Efs8nIiZhn95oxP594Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)