UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P1ZxDY0Ddw9nm8p4Ar0tSKmBcFC35+bzS1629nA25So='
WHERE
key_id = '3d0949727cf2ac0c12870f31e32599d764cc945408bc460ed3e77f953cfe55dd'
AND (
token = 'P1ZxDY0Ddw9nm8p4Ar0tSKmBcFC35+bzS1629nA25So='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)