UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8Zlv6gs+ZRgpyV9isxoH9QHbISDlZ+yN/kAfkjY+7bM=' 
WHERE 
  key_id = '565bd27784d4b17cabca293837c34c53ee747dcc978964975ea99e48afe7ca0a' 
  AND (
    token = '8Zlv6gs+ZRgpyV9isxoH9QHbISDlZ+yN/kAfkjY+7bM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00014