UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KANVqC8agPsKo2VQGa4qdADODpeIs7AXpBthfyL7Sdo=' 
WHERE 
  key_id = '6c8ea9284e49098553712529e5f57f61bfdaae275b3271d8d4622fc242c01d42' 
  AND (
    token = 'KANVqC8agPsKo2VQGa4qdADODpeIs7AXpBthfyL7Sdo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021