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

Query time 0.00033