UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GqN7bQ5Uwpom15rK3a8UmwoaY6E7nhrWpaBWAM97xKg=' 
WHERE 
  key_id = 'ea305a832736c520d817ec89887871726d0e7992feec621460102a4b796a1d94' 
  AND (
    token = 'GqN7bQ5Uwpom15rK3a8UmwoaY6E7nhrWpaBWAM97xKg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033