UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TtMp1idhM//4DVjL7jIC9LOBk4JtxZluYzCkpdWSwQI=' 
WHERE 
  key_id = 'ab697530c17502e4473f97051520a3fad12aa7dfa06807fe290843236131ad43' 
  AND (
    token = 'TtMp1idhM//4DVjL7jIC9LOBk4JtxZluYzCkpdWSwQI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050