UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6m1zdy8tnZjG6lEZZ1LQwe9Z6fqu2fxbLl94AwPpJvs='
WHERE
key_id = '1d9b475224b08e476515d320325803930207ad7ca8bc97a451d4dc555b4a302b'
AND (
token = '6m1zdy8tnZjG6lEZZ1LQwe9Z6fqu2fxbLl94AwPpJvs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)