UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'teEXzwkY+a4xbY6zGVQNBb4N1eeq3oCZrboz93H65cA=' 
WHERE 
  key_id = '76637f0b62c4faf033f4bcab1354ee3d79af25fd8a12c6790bf1fc8fa7b4e7df' 
  AND (
    token = 'teEXzwkY+a4xbY6zGVQNBb4N1eeq3oCZrboz93H65cA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036