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

Query time 0.00033