UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1gGvfyhY7CbJ57Z0664PUFt86hscBi5jOeFF6UkL1H4='
WHERE
key_id = '91f21efa0b6609075ad33b77791a9fa3d11f68e25a6c9da07adef4422d73493d'
AND (
token = '1gGvfyhY7CbJ57Z0664PUFt86hscBi5jOeFF6UkL1H4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)