UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3FiGhpF1c16aGGRzDXvpr+il1W91BqDODvj8aI4zK3k=' 
WHERE 
  key_id = '488005c3eca809d359198d719e332efb638f96944c0830e03c43649cb01c98dd' 
  AND (
    token = '3FiGhpF1c16aGGRzDXvpr+il1W91BqDODvj8aI4zK3k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027