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