UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M7ck1ibK6Skf7nmA46iSDvm1bupzCTll/BoU5f5bYvs=' 
WHERE 
  key_id = '3826df6327a8c24c19397685c2cd8426249665fff643acfa4c1cadee29491334' 
  AND (
    token = 'M7ck1ibK6Skf7nmA46iSDvm1bupzCTll/BoU5f5bYvs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027