UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aKha9BkzXbTozivBbeo6S3C5uqg2nO6+HzVtCV6dnE8=' 
WHERE 
  key_id = 'e86862188286b8d0ec5434785c300fda9fc0262ef41cf908c8505ec765dc7c95' 
  AND (
    token = 'aKha9BkzXbTozivBbeo6S3C5uqg2nO6+HzVtCV6dnE8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034