UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DNWXKhhZKWkqWlqqSQ8dr4iWNX5bzBHS67c+RHxCOy4=' 
WHERE 
  key_id = 'b17a1277fd19f757e8e6379ed171c09e07c95553e816fe3afb2307abbd0a1c1d' 
  AND (
    token = 'DNWXKhhZKWkqWlqqSQ8dr4iWNX5bzBHS67c+RHxCOy4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017