UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0J3XC6IoDNACvXzzzLaeoql7L87BRCpdQxE6J2vW7P4=' 
WHERE 
  key_id = 'd82c482b93d4887c32065bb0435eb05502d22b449b122475432cba953758024a' 
  AND (
    token = '0J3XC6IoDNACvXzzzLaeoql7L87BRCpdQxE6J2vW7P4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056