UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MwzDNm8zgocyBx0SwVgW9lFewRSwyBDoseo/2e9tfTs=' 
WHERE 
  key_id = 'af1ace55c615d317684025337717eebdd672b8a68e265f308d243da8a87ea384' 
  AND (
    token = 'MwzDNm8zgocyBx0SwVgW9lFewRSwyBDoseo/2e9tfTs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034