UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pgxPD7x/BQ/xO6GubFS6j7Gy6rWnXawYO0rANU2LG5c=' 
WHERE 
  key_id = '769e618c80389b28b7081292ee458d4987e641c34b06b0215068d7ee30faa4a5' 
  AND (
    token = 'pgxPD7x/BQ/xO6GubFS6j7Gy6rWnXawYO0rANU2LG5c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030