UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dIUer4uvbS1a1v8SPHxOTO2v8bi6NAbdLamayc0PLfE='
WHERE
key_id = '99065772265f357dc226f42e16d9c28bac1750748d8c83459d7f2a9ba4711a50'
AND (
token = 'dIUer4uvbS1a1v8SPHxOTO2v8bi6NAbdLamayc0PLfE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)