UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0IT9CvceO9Sp0lFjLItF+iP6AFFLLFRREWrdsATq2dc=' 
WHERE 
  key_id = '2cbef19396452a372a526e0635ea386d2ee95d3675bf794f4d4c639fcfd90107' 
  AND (
    token = '0IT9CvceO9Sp0lFjLItF+iP6AFFLLFRREWrdsATq2dc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020