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