UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gi5x0v86nnvZ0sh3jMEu+8jiUgmaBkaThZtWP3lF6vM=' 
WHERE 
  key_id = '1027cff6fad3a7209e49b937865223d4bf4ca47c203ece6629ed9e771b29270a' 
  AND (
    token = 'Gi5x0v86nnvZ0sh3jMEu+8jiUgmaBkaThZtWP3lF6vM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032