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