UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ly059F1phqj6T5gx5Q5xDMWK0vn0yPcdrYZc/f1MubA='
WHERE
key_id = 'e3d981e51f71995136cc6ce0e417a317e5dd5318273699081e5fdb289344880c'
AND (
token = 'ly059F1phqj6T5gx5Q5xDMWK0vn0yPcdrYZc/f1MubA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)