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